package com.ruoyi.xsp.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.xsp.mapper.XspCommentReplyMapper;
import com.ruoyi.xsp.domain.XspCommentReply;
import com.ruoyi.xsp.service.IXspCommentReplyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 回复Service业务层处理
 * 
 * @author zhiminhu
 * @date 2021-03-01
 */
@Service
public class XspCommentReplyServiceImpl implements IXspCommentReplyService 
{
    @Autowired
    private XspCommentReplyMapper xspCommentReplyMapper;

    /**
     * 查询回复
     * 
     * @param id 回复ID
     * @return 回复
     */
    @Override
    public XspCommentReply selectXspCommentReplyById(Integer id)
    {
        return xspCommentReplyMapper.selectXspCommentReplyById(id);
    }

    /**
     * 查询回复列表
     * 
     * @param xspCommentReply 回复
     * @return 回复
     */
    @Override
    public List<XspCommentReply> selectXspCommentReplyList(XspCommentReply xspCommentReply)
    {
        return xspCommentReplyMapper.selectXspCommentReplyList(xspCommentReply);
    }

    /**
     * 新增回复
     * 
     * @param xspCommentReply 回复
     * @return 结果
     */
    @Override
    public int insertXspCommentReply(XspCommentReply xspCommentReply)
    {
        xspCommentReply.setCreateTime(DateUtils.getNowDate());
        return xspCommentReplyMapper.insertXspCommentReply(xspCommentReply);
    }

    /**
     * 修改回复
     * 
     * @param xspCommentReply 回复
     * @return 结果
     */
    @Override
    public int updateXspCommentReply(XspCommentReply xspCommentReply)
    {
        return xspCommentReplyMapper.updateXspCommentReply(xspCommentReply);
    }

    /**
     * 删除回复对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteXspCommentReplyByIds(String ids)
    {
        return xspCommentReplyMapper.deleteXspCommentReplyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除回复信息
     * 
     * @param id 回复ID
     * @return 结果
     */
    @Override
    public int deleteXspCommentReplyById(Integer id)
    {
        return xspCommentReplyMapper.deleteXspCommentReplyById(id);
    }

    @Override
    public int deleteXspCommentReplyByCommentId(Integer id){
        return xspCommentReplyMapper.deleteXspCommentReplyByCommentId(id);
    }

    /**
     * 批量审核
     * @param ids 批量审核的ID
     * @param status 批量审核的状态
     * @return
     */
    @Override
    public int checkXspCommentReplyByIds(String ids,int status){
        return xspCommentReplyMapper.checkXspCommentReplyByIds(Convert.toStrArray(ids),status);
    }
}
